<?php
return array(
	'behaviors' => array(
		'stateHandle' => array(
			'class' => 'ModelState',
			'handleField' => 'status',
			'configName' => 'status.agent.audit',
			'configReader' => Yii::app()->config,
			'initState' => 'ST_NONE',
		),
		'AutoIdResolve' => array(
			'class' => 'coms.behaviors.agent.AutoIdResolve',
		),
		'repeatAgentRelated'=>array(
			'class'=>'coms.behaviors.agent.RepeatAgentRelated'
		),
		'userScope' => array(
			'class' => 'coms.behaviors.userScopes.DefaultScope',
			'relatedFields' => array(
				'provider_id',
				'dealer_id',
			),
		),
	),
	
	'attributeLabels' => array(
		'status' => '状态',
		'provider_id' => '供货商',
		'dealer_id' => '经销商',
		'dealer.worker_name' => '经销商',
		'provider.worker_name' => '供货商',
	),
	
	'rules' => array(
		array('status','safe','on'=>'search'),
		array('dealer_id, provider_id', 'required'),
	),
	'relations' => array(
		'dealer' => array(ActiveRecord::BELONGS_TO, 'WorkerAccount','dealer_id'),
		'provider' => array(ActiveRecord::BELONGS_TO, 'WorkerAccount','provider_id'),
	),
	
	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);